package com.powerhousecreative.q;

import java.io.File;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
//import com.nostra13.universalimageloader.utils.StorageUtils;

import android.app.Application;

public class ImageLoaderSetting extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        
        //File cacheDir = StorageUtils.getCacheDirectory(getBaseContext());
        
        DisplayImageOptions options = new DisplayImageOptions.Builder()
    	.showStubImage(R.drawable.placeholder)
    	.showImageForEmptyUri(R.drawable.placeholder)
    	.showImageOnFail(R.drawable.placeholder)
    	.cacheInMemory(true)
    	.cacheOnDisc(true)
    	.build();

        // Create global configuration and initialize ImageLoader with this configuration
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
        	.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
            .threadPoolSize(3) // default
            .threadPriority(Thread.NORM_PRIORITY - 1) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .discCacheSize(50 * 1024 * 1024)
            .discCacheFileCount(100)
            .imageDownloader(new BaseImageDownloader(getApplicationContext())) // default
            .defaultDisplayImageOptions(options) // default
            .writeDebugLogs()
            .build();
        ImageLoader.getInstance().init(config);
        
        
        
    }
}
